load("@fbsource//tools/build_defs/dirsync:fb_dirsync_cpp_library.bzl", "fb_dirsync_cpp_library")
load("@fbsource//xplat/folly:defs.bzl", "folly_xplat_library")
load("@fbsource//xplat/pfh/triage_InfrastructureSupermoduleOptou:DEFS.bzl", "triage_InfrastructureSupermoduleOptou")

oncall("fbcode_entropy_wardens_folly")

fb_dirsync_cpp_library(
    name = "at_fork",
    srcs = ["AtFork.cpp"],
    headers = ["AtFork.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        "//folly:scope_guard",
        "//folly/lang:exception",
        "//folly/portability:pthread",
        "//folly/synchronization:sanitize_thread",
    ],
    exported_deps = [
        "//folly:function",
        "//folly/portability:sys_types",
    ],
)

fb_dirsync_cpp_library(
    name = "aux_vector",
    headers = ["AuxVector.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    exported_deps = [
        "//folly:portability",
        "//folly:preprocessor",
    ],
)

fb_dirsync_cpp_library(
    name = "env_util",
    srcs = ["EnvUtil.cpp"],
    headers = ["EnvUtil.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        "//folly:string",
        "//folly/portability:stdlib",
        "//folly/portability:unistd",
    ],
    exported_deps = [
        "//folly:c_portability",
        "//folly:memory",
    ],
    external_deps = ["glog"],
)

fb_dirsync_cpp_library(
    name = "hardware_concurrency",
    srcs = ["HardwareConcurrency.cpp"],
    headers = ["HardwareConcurrency.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        "//folly:utility",
        "//folly/lang:safe_assert",
        "//folly/portability:sched",
    ],
)

fb_dirsync_cpp_library(
    name = "memory_mapping",
    srcs = ["MemoryMapping.cpp"],
    headers = ["MemoryMapping.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        "fbsource//third-party/fmt:fmt",
        "//folly:portability",
        "//folly/experimental/io:huge_pages",
        "//folly/portability:gflags",
        "//folly/portability:sys_mman",
        "//folly/portability:sys_syscall",
    ],
    exported_deps = [
        "//folly:file",
        "//folly:range",
        "//folly/portability:unistd",
    ],
    external_deps = ["glog"],
)

fb_dirsync_cpp_library(
    name = "pid",
    srcs = ["Pid.cpp"],
    headers = ["Pid.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        ":at_fork",
        "//folly/portability:unistd",
    ],
    exported_deps = [
        "//folly/portability:sys_types",
    ],
    external_deps = ["glog"],
)

fb_dirsync_cpp_library(
    name = "shell",
    srcs = ["Shell.cpp"],
    headers = ["Shell.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    exported_deps = [
        "//folly:conv",
        "//folly:format",
        "//folly:range",
    ],
)

fb_dirsync_cpp_library(
    name = "thread_id",
    srcs = ["ThreadId.cpp"],
    headers = ["ThreadId.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        ":at_fork",
        "//folly:likely",
        "//folly/portability:pthread",
        "//folly/portability:sys_syscall",
        "//folly/portability:unistd",
        "//folly/portability:windows",
        "//folly/synchronization:relaxed_atomic",
    ],
)

fb_dirsync_cpp_library(
    name = "thread_name",
    srcs = ["ThreadName.cpp"],
    headers = ["ThreadName.h"],
    feature = triage_InfrastructureSupermoduleOptou,
    use_raw_headers = True,
    xplat_impl = folly_xplat_library,
    deps = [
        "//folly:portability",
        "//folly:scope_guard",
        "//folly:traits",
        "//folly/portability:windows",
    ],
    exported_deps = [
        "//folly:optional",
        "//folly:range",
        "//folly/portability:config",
        "//folly/portability:pthread",
    ],
)
